package com.mini.mysql.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mini.mysql.model.BusinessStudentInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.FieldNameConstants;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Entity;
import javax.persistence.Id;
import java.io.Serializable;
import java.util.Date;
@Data
@FieldNameConstants
@NoArgsConstructor
@AllArgsConstructor
@Entity
@DynamicInsert
@DynamicUpdate
@ApiModel(value = "大课订单-小程序订单表")
public class BusinessStudentBigLessonXcx implements Serializable  {

    private static final long serialVersionUID = 7025694821399528298L;
    @Id
    @ApiModelProperty(value = "大课订单编号-对应的是小程序同步过来的大课订单")
    private String orderNo;

    @ApiModelProperty(value = "手机号")
    private String phoneNumber;

    @ApiModelProperty(value = "匹配到的小课订单的小课站点")
    private Long lessonSiteId;
    @ApiModelProperty(value = "匹配到的小课订单编号，冗余字段，方便查询使用")
    private String miniOrderNo;

    private Long lessonId;
    @ApiModelProperty(value = "大课课程名称")
    private String lessonName;

    private String teachPlanId;

    private String teachPlanName;

    private String skuCode;

    private String skuName;

    @ApiModelProperty(value = "订单生成时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date orderCreateTime;
    @ApiModelProperty(value = "支付发起时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date payStartTime;
    @ApiModelProperty(value = "支付完成时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date payFinishTime;
    @ApiModelProperty(value = "订单状态：5/15/25")
    private String orderState;
    //使用a_id,b_id这种形式,[,]前不要带空格。。。
//    @Excel(name = "小程序大课订单状态_bigLessonOrderXcx,有赞大课订单状态_bigLessonOrderYouzan",
//            orderNum = "24_bigLessonOrderXcx,26_bigLessonOrderYouzan")
    @ApiModelProperty(value = "订单状态name")
    private String orderStateStr;
    @ApiModelProperty(value = "商品价格")
    private Float price;

    @ApiModelProperty(value = "支付金额")
    private Float payAmount;
    @ApiModelProperty(value = "优惠金额")
    private Float couponAmount;
    @ApiModelProperty(value = "用户昵称")
    private String username;
    @ApiModelProperty(value = "优惠码")
    private String couponCode;

    @ApiModelProperty(value = "大课成单渠道：0-有赞，1-直播带货")
    private String orderSourceType;

    private String remark;

    private Integer orderDepositType;

    private Integer depositMergeState;

    private String relatedKey;

    private String refOrderNo;

    private Integer installmentNum;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date refundTime;

    private Float refundAmount;

    private String refundStatus;

    private String changeClassStatus;

    private String changeClassStatusName;

    private String changeClassRelatedKey;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    private String sku;

    private String workRoom;

    private String od;

    private String og;

    private String teacherId;

    private Integer bindState;

    @ApiModelProperty(value = "备注信息-运营人员编辑")
    private String operateRemark;

    @ApiModelProperty(value = "流水归属：0-默认，1-一阶，2-2阶段")
    private Integer operationStage;
    @ApiModelProperty(value = "二阶机会id")
    private Long secondOrderId;

    @ApiModelProperty(value = "0-传统订单/1-BF订单")
    private Integer orderChannelType;


    public enum OrderSourceType {
        ONLINE("1"),
        OFFLINE("0");

        private String code;

        OrderSourceType(String code) {
            this.code = code;
        }

        public String getCode() {
            return code;
        }
    }

    public enum OrderState {
        PAYING("5", "支付中"),
        PAY_FINISH("15", "支付完成"),
        PAY_CANCEL("25", "支付取消"),
        PAY_CREATE("0", "生成订单"),
        PAY_FAIL("10", "支付失败"),
        PAY_TIMEOUT("20", "订单超时"),
        PAY_REFUND_CREATE("30", "退款发起"),
        PAY_REFUND_ING("35", "退款中"),
        PAY_REFUND_SUCCESS("40", "退款成功"),
        PAY_REFUND_FAIL("45", "退款失败");

        private String state;
        private String name;


        OrderState(String state, String name) {
            this.state = state;
            this.name = name;
        }

        public String getState() {
            return state;
        }

        public String getName() {
            return name;
        }

    }


    public enum OrderDeposiType {

        ORDER_NORMAL(0, "普通订单"),
        ORDER_PDEPOSIT(1, "定金订单"),
        ORDER_BALANCE(2, "尾款订单");

        private Integer type;
        private String name;

        OrderDeposiType(int type, String name) {
            this.type = type;
            this.name = name;
        }

        public Integer getType() {
            return type;
        }

        public String getName() {
            return name;
        }
    }
}